package com.ruoyi.baselibrary.infobasepolicy.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.baselibrary.infobasepolicy.domain.InfoBasePolicy;
import com.ruoyi.baselibrary.infobasepolicy.mapper.InfoBasePolicyMapper;
import com.ruoyi.baselibrary.infobasepolicy.service.IInfoBasePolicyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 政策法规Service业务层处理
 *
 * @author ruoyi
 * @date 2022-01-12
 */
@Service
public class InfoBasePolicyServiceImpl implements IInfoBasePolicyService {
    @Autowired
    private InfoBasePolicyMapper infoBasePolicyMapper;

    /**
     * 查询政策法规
     *
     * @param id 政策法规主键
     * @return 政策法规
     */
    @Override
    public InfoBasePolicy selectInfoBasePolicyById(Long id) {
        return infoBasePolicyMapper.selectInfoBasePolicyById(id);
    }

    /**
     * 查询政策法规列表
     *
     * @param infoBasePolicy 政策法规
     * @return 政策法规
     */
    @Override
    public List<InfoBasePolicy> selectInfoBasePolicyList(InfoBasePolicy infoBasePolicy) {
        return infoBasePolicyMapper.selectInfoBasePolicyList(infoBasePolicy);
    }

    /**
     * 新增政策法规
     *
     * @param infoBasePolicy 政策法规
     * @return 结果
     */
    @Override
    public int insertInfoBasePolicy(InfoBasePolicy infoBasePolicy) {
        infoBasePolicy.setCreateTime(DateUtils.getNowDate());
        return infoBasePolicyMapper.insertInfoBasePolicy(infoBasePolicy);
    }

    /**
     * 修改政策法规
     *
     * @param infoBasePolicy 政策法规
     * @return 结果
     */
    @Override
    public int updateInfoBasePolicy(InfoBasePolicy infoBasePolicy) {
        infoBasePolicy.setUpdateTime(DateUtils.getNowDate());
        return infoBasePolicyMapper.updateInfoBasePolicy(infoBasePolicy);
    }

    /**
     * 批量删除政策法规
     *
     * @param ids 需要删除的政策法规主键
     * @return 结果
     */
    @Override
    public int deleteInfoBasePolicyByIds(Long[] ids) {
        return infoBasePolicyMapper.deleteInfoBasePolicyByIds(ids);
    }

    /**
     * 删除政策法规信息
     *
     * @param id 政策法规主键
     * @return 结果
     */
    @Override
    public int deleteInfoBasePolicyById(Long id) {
        return infoBasePolicyMapper.deleteInfoBasePolicyById(id);
    }

}
